package com.boot.security.server.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.AppVisitDetail;

@Mapper
public interface AppVisitDetailDao {

    @Select("select * from app_visit_detail t where t.id = #{id}")
    AppVisitDetail getById(Long id);

    @Delete("delete from app_visit_detail where id = #{id}")
    int delete(Long id);

    int update(AppVisitDetail appVisitDetail);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into app_visit_detail(visitdetailid, hostcode, visitdate, visitno, patientid, cliniclabel, patientname, clinictype, sumfee, receiptno, visitstatus, phone, idno, deptcode, deptname, doctorcode, doctorname, cardtype, cardno, selfdescribe, diageresult, icdcode, diagdescribe) values(#{visitdetailid}, #{hostcode}, #{visitdate}, #{visitno}, #{patientid}, #{cliniclabel}, #{patientname}, #{clinictype}, #{sumfee}, #{receiptno}, #{visitstatus}, #{phone}, #{idno}, #{deptcode}, #{deptname}, #{doctorcode}, #{doctorname}, #{cardtype}, #{cardno}, #{selfdescribe}, #{diageresult}, #{icdcode}, #{diagdescribe})")
    int save(AppVisitDetail appVisitDetail);
    
    int count(@Param("params") Map<String, Object> params);

    List<AppVisitDetail> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
